package test.core;


import test.core.Action;
import test.util.SuiteConfig;
import test.util.TestConfig;

import test.util.Util;

import test.core.ActionSet;

import test.core.Check;
import com.thoughtworks.selenium.*;

public class SeleneseTestCaseEx extends SeleneseTestCase{
	
	public static Action action;
	public static ActionSet actionset;
	public static Check check;
	public static DefaultSeleniumEx browser;
	public static SuiteConfig sc = SuiteConfig.getInstance();
	public static TestConfig tc = TestConfig.getInstance();
	public static Util u = new Util();
	public static Boolean configTest = true;
	public static ResultEngine resEng;
	
	public SeleneseTestCaseEx(String name) {
		super(name);
	}
	
	public void setUp () {
		if(configTest){
			browser = new DefaultSeleniumEx(getServerName(), getPort(), getBrowser(), tc.getEnv("mainurl"));
//			System.out.print(getServerName());
//			System.out.print(getPort());
//			System.out.print(getBrowser());
//			System.out.print(tc.getEnv("mainUrl"));
			action = new Action();
			actionset = new ActionSet();
			configTest = false;
			check = new Check();
			resEng = new ResultEngine();
		}
		
	}
	
	
	
	public static String getServerName() {
		if (sc.getEnv("servername")== null) {
			return tc.getEnv("servername");
		} else {
			return sc.getEnv("servername");
		}
	}
	
	public static Integer getPort() {
		if (sc.getEnv("port")== null) {
			return Integer.parseInt(tc.getEnv("port"));
		} else {
			return Integer.parseInt(sc.getEnv("port"));
		}
		
	}
	
	public static String getBrowser() {
		if (sc.getEnv("browser")== null) {
			return tc.getEnv("browser");
		} else {
			return sc.getEnv("browser");
		}
	}
}
